1 <table height="28" cellSpacing="0" cellPadding="0" width="100%" border="0">
2       <tr align=center>
3         <td
class="title" width="100%">Quản lý quảng cáo
4     </td>
5       </tr>
6     </table>
7 <?
8     
switch ($_GET['action'])
9     {
10         
case 'del' :
11             $id = $_GET[
'id'];
12             $sql=
"select * from quangcao where id=$id limit 1";
13             $pro=mysql_fetch_assoc(mysql_query($sql,$con));
14             $link=
"../";
15             
if ($pro)
16             {
17                 $sql =
"delete from quangcao where id='".$id."'";
18                 $result = mysql_query($sql,$con);
19                 
if ($result)
20                 {
21                     
if (file_exists($link.$pro['image'])) unlink($link.$pro['image']);
22                     
if (file_exists($link.$pro['image_large'])) unlink($link.$pro['image_large']);
23                     echo
"<p align=center class='err'>&#272;ã xóa thành công</p>";
24                 }
25                     
else echo "<p align=center class='err'>Không th&#7875; xóa d&#7919; li&#7879;u</p>";
26             }
27             
break;
28     }
29 ?>
30
31 <?
32     
if (isset($_POST['ButDel'])) {
33         $cnt=
0;
34         
foreach ($_POST['chk'] as $id)
35         {
36             $sql=
"select * from quangcao where id=$id limit 1";
37             $pro=mysql_fetch_assoc(mysql_query($sql,$con));
38             $link=
"../";
39             
if ($pro)
40             {
41                 @$result = mysql_query(
"delete from quangcao where id='".$id."'",$con);
42                 
if ($result) {
43                     $cnt++;
44                     
if (file_exists($link.$pro['image'])) unlink($link.$pro['image']);
45                     
if (file_exists($link.$pro['image_large'])) unlink($link.$pro['image_large']);
46                 }
47             }
48         }
49         echo
"<p align=center class='err'>&#272;ã xóa ".$cnt." ph&#7847;n t&#7917;</p>";
50     }
51 ?>
52
53 <?
54     $page = $_GET[
"page"];
55     $MAXPAGE=
10;
56     $p=
0;
57     
if ($page!='') $p=$page;
58 ?>
59 <form method=
"POST" name="frmList" action="">
60 <input type=
"hidden" name="act" value="quangcao">
61 <input type=hidden name=
"page" value="<? echo $page; ?>">
62 <?
63 function taotrang($sql,$link,$nitem,$itemcurrent)
64 {
global $con;
65     $ret=
"";
66     $result = mysql_query($sql, $con) or die(
'Error' . mysql_error());
67     $
value = mysql_fetch_array($result);
68     $plus = (($
value['cnt'] % $nitem)>0);
69     
for ($i=0;$i<($value[0] / $nitem) + plus;$i++)
70     {
71         
if ($i<>$itemcurrent) $ret .= "<a href=\"".$link.$i."\" class=\"lslink\">".($i+1)."</a> ";
72         
else $ret .= ($i+1)." ";
73     }
74     
return $ret;
75 }
76     $pageindex=taotrang(
"select count(*) from quangcao","./?act=quangcao"."&page=",$MAXPAGE,$page);
77 ?>
78
79 <table cellspacing=
"0" cellpadding="0" width="100%">
80 <?
if ($_REQUEST['code']==1) echo '<tr><td align="center" class="err">&#272;ã c&#7853;p nh&#7853;t thành công</td></tr>'; ?>
81 <tr>
82 <td
class="smallfont">Trang : <? echo $pageindex; ?></td>
83 </tr>
84 </table>
85
86 <table border=
"1" cellpadding="2" style="border-collapse: collapse" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
87   <tr>
88     <td align=center nowrap
class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
89     <td colspan=
"2" nowrap class="title">&nbsp;</td>
90     <td align=
"center" nowrap class="title"><b>ID</b></td>
91     <td align=
"center" nowrap class="title"><b>User</b></td>
92       <td align=
"center" nowrap class="title"><b>Trạng thái</b></td>
93         <td align=
"center" nowrap class="title"><b>Thời gian</b></td>
94           <td align=
"center" nowrap class="title"><b>Loại quảng cáo</b></td>
95             <td align=
"center" nowrap class="title"><b>Ngày kích hoạt</b></td>
96               <td align=
"center" nowrap class="title"><b>Ngày hết hạn</b></td>
97     <td align=
"center" nowrap class="title"><b>Thanh toán</b></td>
98     <td align=
"center" nowrap class="title"><b>Banner</b></td>
99      <td align=
"center" nowrap class="title"><b>ID SP</b></td>
100     <td align=
"center" nowrap class="title"><b>Thứ tự</b></td>
101     <td align=
"center" nowrap class="title"><b>Ghi chú</b></td>
102   </tr>
103   
104   <?php
105             $sql=
"select * from quangcao order by id limit ".($p*$MAXPAGE).",".$MAXPAGE;
106             $result=mysql_query($sql,$con);
107             $i=
0;
108             
while(($row=mysql_fetch_array($result)))
109             {
110             $i++;
111             
if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
112   ?>
113   
114   <tr>
115     <td align=
"center" bgcolor="<? echo $color; ?>" class="smallfont">
116     <input type=
"checkbox" name="chk[]" value="<? echo $row['id']; ?>"></td>
117     <td align=
"center" bgcolor="<? echo $color; ?>" class="smallfont">
118     <a href=
"./?act=suaquangcao&id=<? echo $row['id']; ?>&page=<? echo $_REQUEST['page'];?>">S&#7917;a</a></td>
119     <td align=
"center" bgcolor="<? echo $color; ?>" class="smallfont">
120     <a onclick=
"return confirm('B&#7841;n có ch&#7855;c ch&#7855;n mu&#7889;n xoá ?');" href="./?act=quangcao&page=<? echo $_REQUEST['page']; ?>&action=del&id=<? echo $row['id']; ?>">Xóa</a></td>
121     <td bgcolor=
"<? echo $color; ?>" align="left" align="left" class="smallfont"><? echo $row['id']; ?>&nbsp;</td>
122     <td bgcolor=
"<? echo $color; ?>" align="left" align="left" class="smallfont"><? echo $row['user']; ?>&nbsp;</td>
123     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['status']; ?>&nbsp;</td>
124     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['thoigian']; ?> ngày</td>
125
126      <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['name']; ?>&nbsp;</td>
127     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['date']; ?>&nbsp;</td>
128         <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['dateend']; ?>&nbsp;</td>
129             <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['thanhtoan']; ?>&nbsp;</td>
130                 <td bgcolor=
"<? echo $color; ?>" class="smallfont"><a target="bank_" href="/<? echo $row['banner'];?>" ><img src="/<? echo $row['banner'];?>" width="100" height="50"></a></&nbsp;</td>
131                      <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['sanpham']; ?>&nbsp;</td>
132                    <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['thutu']; ?>&nbsp;</td>
133                         <td width=
"160px" bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['ghichu']; ?>&nbsp;</td>
134   </tr>
135   <?
136                 }
137   ?>
138 </table>
139 <input type=
"submit" value="Xóa Ch&#7885;n" name="ButDel" onclick="return confirm('B&#7841;n có ch&#7855;c ch&#7855;n mu&#7889;n xoá ?');" class="button">
140 </form>
141 <script language=
"JavaScript">
142 function chkallClick(o) {
143     
var form = document.frmList;
144     
for (var i = 0; i < form.elements.length; i++) {
145         
if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
146             form.elements[i].
checked = document.frmList.chkall.checked;
147         }
148     }
149 }
150 </script>



Full source code website bán hàng thương mại điện tử gần giống shopee 468.792 lượt xem

Gõ tìm kiếm nhanh...